﻿@model IEnumerable<DynamicQuery.SampleData.Product>
@using DynamicQuery.Mvc;
@using DynamicQuery;

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Product List</h2>
<a href="@Url.Action("Index")">View Non-Paged Version</a>

<div class="container">
    <form class=".form-search">
        @Html.QueryTextbox("Name", "Product Name", QueryOperator.CONTAINS)
        <input type="submit" value="Search" class="btn" />
    </form>
</div>

<div class="row">
    <div class="span12 offset2   ">
        <table class="table table-striped">
            <thead>
                <tr>
                    <td>ID</td>
                    <td>Category</td>
                    <td>Name</td>
                    <td>Price</td>
                    <td>Description</td>
                </tr>
            </thead>
            <tbody>
                @foreach (var p in @Model)
                {
                    <tr>
                        <td>@p.Id</td>
                        <td>@p.Category.Name</td>
                        <td>@p.Name</td>
                        <td>@p.Price</td>
                        <td>@p.Description</td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
</div>
<div class="pull-right">
    @Html.QueryPager((Pager)ViewBag.Pager); 
</div>
